//
// Created by 11510 on 2025/10/1.
//

#include <iostream>
#include "libserialtest.h"
#include "BuildXML.h"
#include "ModBusProtocolCodec.h"
int test() {

    ModBusProtocolCodec codec;
    IProtocolCodec::CodecArgs args;
    args.push_back(uint8_t(0x01));
    args.push_back(uint16_t(0x0300));
    args.push_back(uint8_t(0x0A));

    auto frame = codec.buildReadFrame(uint8_t(0x03), args);

    uint8_t data[] = {
            0x01,
            0x03,
            0x14,
            0x00,
            0x01,
            0x00,
            0x00,
            0x25,
            0x80,
            0x00,
            0x00,
            0x00,
            0x03,
            0x00,
            0x03,
            0x3F,
            0x80,
            0x00,
            0x00,
            0x00,
            0x00,
            0x00,
            0x00,
            0x1D,
            0x58
    };
    IProtocolCodec::CodecArgs args2;
    args2.push_back(uint8_t(1));
    args2.push_back(uint8_t(2));
    args2.push_back(uint8_t(1));
    args2.push_back(uint8_t(1));
    args2.push_back(uint8_t(1));
    args2.push_back(uint8_t(2));
    args2.push_back(uint8_t(2));
    auto out = codec.parseReadResponse(data, uint8_t(0x03), args2);


    return 0;
}
